package com.nbsaas.boot.product.rest.resource;

import com.nbsaas.boot.product.api.apis.ProductFileApi;
import com.nbsaas.boot.product.data.entity.ProductFile;
import com.nbsaas.boot.product.api.domain.request.ProductFileRequest;
import com.nbsaas.boot.product.api.domain.response.ProductFileResponse;
import com.nbsaas.boot.product.api.domain.simple.ProductFileSimple;
import com.nbsaas.boot.product.rest.convert.ProductFileSimpleConvert;
import com.nbsaas.boot.product.rest.convert.ProductFileEntityConvert;
import com.nbsaas.boot.product.rest.convert.ProductFileResponseConvert;
import com.nbsaas.boot.product.data.repository.ProductFileRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import jakarta.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   商品文件-业务接口实现
*/
@Transactional
@Service
public class ProductFileResource extends BaseResource<ProductFile,ProductFileResponse, ProductFileSimple, ProductFileRequest>  implements ProductFileApi {

    @Resource
    private ProductFileRepository productFileRepository;

    @Override
    public JpaRepositoryImplementation<ProductFile, Serializable> getJpaRepository() {
        return productFileRepository;
    }

    @Override
    public Function<ProductFile, ProductFileSimple> getConvertSimple() {
        return new ProductFileSimpleConvert();
    }

    @Override
    public Function<ProductFileRequest, ProductFile> getConvertForm() {
        return new ProductFileEntityConvert();
    }

    @Override
    public Function<ProductFile, ProductFileResponse> getConvertResponse() {
        return new ProductFileResponseConvert();
    }




}


